/**
 * Project Name:九色鹿
 * File Name:EnglishName.java
 * Package Name:com.fxp.project.jiuselu.commons.name.en
 * Date:2020年04月06日 11:23
 * Copyright (c) 2020, Jason.Wang All Rights Reserved.
 */
package com.fxp.project.jiuselu.commons.name.en;

import com.fxp.project.jiuselu.commons.name.IRandomName;
import com.fxp.project.jiuselu.commons.name.Language;

import java.util.Random;

/**
 * ClassName:EnglishName<br/>
 * Function: 英文名称<br/>
 * Date:2020年04月06日 11:23<br/>
 *
 * @author Jason.Wang
 * @version 1.0.0.0
 * @see
 * @since JDK1.8
 */
public class EnglishName implements IRandomName {
    /**
     * 随机对象
     */
    private Random random;
    /**
     * 记录下一个值的索引
     */
    private int next;

    /**
     * 默认的创建方式
     */
    public EnglishName() {
        random = new Random();
    }

    /**
     * getTranslateName: 获取转换后的名称<br/>
     *
     * @param language
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:38
     */
    public String getTranslateName(Language language) {
        String translateName = null;
        switch (language) {
            default:
                if (next < TranslateZh.namesZh.length) {
                    translateName = TranslateZh.namesZh[next];
                }
                break;
        }
        return translateName;
    }

    /**
     * insideName: 获取数组中的英文名称<br/>
     *
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:38
     */
    private String insideName() {
        next = random.nextInt(SourceEn.namesEn.length);
        return SourceEn.namesEn[next];
    }

    /**
     * getFullName: 获取全名<br/>
     *
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:21
     */
    @Override
    public String getFullName() {
        return insideName();
    }

    /**
     * getSplitName: 数组 [姓,名]<br/>
     *
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:22
     */
    @Override
    public String[] getSplitName() {
        return null;
    }

    /**
     * getSimpleName: 中文名称 <br/>
     *
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:22
     */
    @Override
    public String getSimpleName() {
        return insideName();
    }
}
